home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 276-300 / disk_280 / graph / coords.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  2KB  |  50 lines

  1. /*
  2.  *                 GRAPH, Version 1.00 - 4 August 1989
  3.  *
  4.  *            Copyright 1989, David Gay. All Rights Reserved.
  5.  *            This software is freely redistrubatable.
  6.  */
  7.  
  8. /* Set up a coordinate system in a Rastport */
  9. #ifndef COORDS_H
  10. #define COORDS_H
  11.  
  12. /* The class used */
  13. struct RWindow {
  14.     struct RastPort *rp; /* The rastport associated woth this coord system */
  15.     /* The methods : */
  16.     void (*delete)(struct RWindow *this);
  17.     /* Do a Movw/Draw, checks for overflow, etc */
  18.     void (*rdo)(struct RWindow *this, void (*func)(struct RastPort *rp, long sx
  19. , long sy), double x, double y);
  20.     double (*sx)(struct RWindow *this, double x); /* real coords -> rastport co
  21. ords */
  22.     double (*sy)(struct RWindow *this, double y);
  23.     double (*x)(struct RWindow *this, long sx);   /* rastport coords -> real co
  24. ords */
  25.     double (*y)(struct RWindow *this, long sy);
  26. };
  27.  
  28. /* Create a coordinate system in Rastport rp (w by h pixels),
  29.    {x,y}{min,max}offset : offset in rp at which coords starts (normally > 0)
  30.    {x,y}{min,max} : limits for coords
  31.    logx, logy : logarithmic scale ?
  32.    clip : setup clipping to {x,y}{min,max}offset boundaries ?
  33. */
  34. struct RWindow *new_RWindow(struct RastPort *rp, long w, long h,
  35.                             long xminoffset, long yminoffset, long xmaxoffset,
  36. long ymaxoffset,
  37.                             double xmin, double ymin, double xmax, double ymax,
  38.      
  39.                             long logx, long logy, long clip);
  40. long ftol(double x); /* convert double to integer, round down. cf floor */
  41.  
  42. extern void Move(), BigDraw();
  43.  
  44. /* Easy calling for Move, Draw in real coords */
  45. #define RMove(rwin, x, y) ((rwin)->rdo((rwin), Move, (x), (y)))
  46. #define RDraw(rwin, x, y) ((rwin)->rdo((rwin), BigDraw, (x), (y)))
  47.  
  48. #endif
  49.  
  50.